package com.neusoft.ysu.npms.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.neusoft.ysu.npms.pojo.Department;
import com.neusoft.ysu.npms.mapper.DepartmentMapper;
import com.neusoft.ysu.npms.pojo.DepartmentInfo;
import com.neusoft.ysu.npms.pojo.Result;
import com.neusoft.ysu.npms.service.IDepartmentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 作者：刘金秋
 * @since 2024-06-18
 */
@Service
public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Department> implements IDepartmentService {
    @Autowired
    DepartmentMapper departmentMapper;

    @Override
    public Result add(Department type) {
        return new Result<>(0, "", departmentMapper.add(type));
    }

    @Override
    public Result deleteMeasure(Department department){
        return new Result<>(0,"",departmentMapper.deleteMeasure(department));
    }

    @Override
    public Result updateMeasure(Department department){
        return new Result<>(0,"",departmentMapper.updateMeasure(department));
    }

    @Override
    public Result selectAll(){
        return new Result<>(0,"",departmentMapper.selectAll());
    }
    @Override
    public Result findById(Department department){
        return new Result<>(0,"",departmentMapper.findById(department));
    }
    @Override
    public PageInfo getlist(DepartmentInfo departmentInfo, int pageNum, int pageSize){
        PageHelper.startPage(pageNum, pageSize);
        List<DepartmentInfo>infos=departmentMapper.getlist(departmentInfo);
        return new PageInfo(infos);
    }

}
